package fuxi;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.LinkedList;
import java.util.List;

public class TestW {
	public static void main(String[] args) {
		File s=new File("d:\\练习文本.txt");
		List<Duixiang> w=new LinkedList<>();
		w.add(new Duixiang("张三","一年级一班","第三排第五位"));
		w.add(new Duixiang("李四","二年级二班","第四排第二位"));
		w.add(new Duixiang("王五","三年级六班","第六排第六位"));
		w.add(new Duixiang("冯六","四年级四班","第一排第三位"));
		w.add(new Duixiang("宋七","五年级七班","第二排第一位"));
		w.add(new Duixiang("木八","六年级四班","第一排第三位"));
		
		try {
			ObjectOutputStream x=new ObjectOutputStream(new FileOutputStream(s));
			for (Duixiang String : w) {
				x.writeObject(String);
				}
			x.flush();x.close();
			System.out.println("写入完成");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}

}
